package com.yt.al.util;

import static org.junit.Assert.assertEquals;

import java.util.Calendar;

import org.apache.log4j.Logger;

public class TestUtil {
	/**
	 * 璁剧疆椤甸潰锟�?锟斤拷锟�?濡傛灉锟�?锟斤拷宸粨鏋滈敊璇笉褰卞搷缁х画鎵ц
	 * @param str   鏈熸湜鐨勭粨锟�?
	 * @param title 椤甸潰鑾峰彇鐨勭粨锟�?
	 * @param msg   褰撳墠鎵ц鐨勭敤锟�?
	 * @param sBuffer 鎵ц鍒ゆ柇缁撴灉淇℃伅
	 * 
	 **/
	public static void  setPoint(String str, String title,String msg,StringBuffer verificationErrors) {
		try {
			assertEquals(str, title.trim());
			Logger.getLogger("CheckResult").info(msg+"    PASS");
			WriteLogUtil.writeMsgToFile("CheckResult:"+msg+"   pass");
		} catch (Error e) {
			Logger.getLogger("CheckResult").info(msg+"    ERROR:"+e);
			WriteLogUtil.writeMsgToFile("CheckResult"+msg+"   ERROR:"+e);
			verificationErrors.append(e.toString()+"\r\n");
			//WriteLogUtil.writeMsgToFile(verificationErrors+" "+e.toString()+"\r\n");
		}
	}
	/**
	 * 鑾峰彇褰撳墠鏃ユ湡
	 */
	public static int TodayDate(){
		Calendar c = Calendar.getInstance();//鍙互瀵规瘡涓椂闂村煙鍗曠嫭淇敼
		int date = c.get(Calendar.DATE);
		return date;
	}
	public static int year(){
		Calendar c = Calendar.getInstance();//鍙互瀵规瘡涓椂闂村煙鍗曠嫭淇敼
		int year = c.get(Calendar.YEAR);
		return year;
	}
	public static int month(){
		Calendar c = Calendar.getInstance();//鍙互瀵规瘡涓椂闂村煙鍗曠嫭淇敼
		int month = c.get(Calendar.MONTH);
		month++;
		return month;
	}

	/**
	 * 固定等待8秒
	 */
	public static void waits(){
		try {
			Thread.sleep(8000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	/**
	 * 等待指定毫秒数
	 * @param time
	 */
	public static void waits(long time){
		try {
			Thread.sleep(time);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
}
